const namespaced = true;
const state = {
  allMenuList: [
    {
      menu_name: "考试",
      menuId: "0001",
      url: "/exam",
      icon: "icon-lianxi",
      level: 1,
    },
  ], // 完整的菜单数据
  initMenu: false,
  isCollapse: false, // 是否水平折叠收起菜单
};
// getters
const getters = {
  getAllMenuList: (state) => state.allMenuList,
  getInitMenu: (state) => state.initMenu,
  getIsCollapse: (state) => state.isCollapse,
};

const actions = {
  setAllMenuList({ commit }, payload) {
    commit("SET_ALL_MENU_LIST", payload);
  },
  setInitMenu({ commit }, payload) {
    commit("SET_INIT_MENU", payload);
  },
  setIsCollapse({ commit }, payload) {
    commit("SET_IS_COLLAPSE", payload);
  },
};

const mutations = {
  SET_ALL_MENU_LIST(state, payload) {
    state.allMenuList = payload;
  },
  SET_INIT_MENU(state, payload) {
    state.initMenu = payload;
  },
  SET_IS_COLLAPSE(state, payload) {
    state.isCollapse = payload;
  },
};

export default {
  namespaced,
  state,
  getters,
  actions,
  mutations,
};
